home *** CD-ROM | disk | FTP | other *** search
- Path: server-b.cs.interbusiness.it!usenet
- From: Softec@system.abacom.it (Softec@system.abacom.it)
- Newsgroups: comp.lang.c++
- Subject: Help with Cedit view !
- Date: 15 Jan 1996 17:53:19 GMT
- Organization: Centro Servizi Interbusiness
- Message-ID: <4de4af$s71@server-b.cs.interbusiness.it>
- NNTP-Posting-Host: system.abacom.it
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.99.2
-
- I'm developing an editor using the Microsoft Visual C++ and the MFC.
- My editor has the following features:
- 1. Show the content of a ASCII file.
- 2. Change the text color and the background color of a line when a particular
- condition occours (same as when I set a breakpoint in the Visual C++ editor)
-
- I tried to derivated the CEditView class and I loaded the file using the following code:
-
- CEdit& edit = GetEditCtrl(); // get a reference to the CEdit control
- CFile f; // used by the edit view
-
- if(!f.Open(filename, CFile::modeRead | CFile::typeBinary))
- {
- AfxMessageBox("File no found");
- return 0;
- }
- DWORD len = f.GetLength();
- HLOCAL hBuff = LocalAlloc(LMEM_MOVEABLE,len+1);
- LPSTR = (LPSTR)LocalLock(hBuff);
- f.Read(pbuff,len);
- f.Close();
- pbuff[len]=NULL;
- edit.SetWindowText(pbuff);
- edit.SetReadOnly(TRUE); // Read only
- LocalUnlock(hBuff);
- LocalFree(hBuff);
- return 0;
-
-
- But now I don't know how to change the color of a line.
- Where is somebody that can help me ?
-
- Thank you in advance
- Piero Poletto
-
-
-